package me.zhengjie.modules.easycode.domain;

import lombok.Data;
import me.zhengjie.modules.security.service.dto.JwtUserDto;

/**
 * @author guoqing
 * @date 2021/6/13 17:24
 */
@Data
public class EasyCodeUser {
    /**
     * 用户名
     */
    private String username;
    /**
     * 密码
     */
    private String password;
    /**
     * 昵称
     */
    private String nickName;
    /**
     * token
     */
    private String token;

    /**
     * 作者
     */
    private String author;
    /**
     * 项目编码
     */
    private String projectCode;


    public static EasyCodeUser conversion(String token, JwtUserDto jwtUserDto) {
        EasyCodeUser user = new EasyCodeUser();
        user.setToken(token);
        user.setUsername(jwtUserDto.getUser().getUsername());
        user.setPassword(jwtUserDto.getUser().getPassword());
        user.setNickName(jwtUserDto.getUser().getNickName());
        user.setAuthor(jwtUserDto.getUser().getNickName());

        return user;
    }

}
